import { lazy } from 'react'
import { Navigate } from 'react-router-dom'

const Main = lazy(() => import('@/pages/main/index'))
const Home = lazy(() => import('@/pages/home/index'))
const Share = lazy(() => import('@/pages/share/index'))
const Product = lazy(() => import('@/pages/product/index'))
const UpKeep = lazy(() => import('@/pages/upkeep/index'))
const NoFound = lazy(() => import('@/pages/noFound/index'))

const routes = [
  {
    path: '/',
    element: <Main />,
    children: [
      {
        path: '/',
        element: <Navigate to={'/home'}></Navigate>
      },
      {
        path: '/home',
        element: <Home />
      },
      {
        path: '/share',
        element: <Share />
      },
      {
        path: '/product',
        element: <Product />
      },
      {
        path: '/upKeep',
        element: <UpKeep />
      }
    ]
  },
  // 404
  {
    path: '*',
    element: <NoFound />
  }
]

export default routes
